package com.msmall.community.common.action;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.msmall.base.action.BaseAction;
import com.msmall.base.util.StringUtil;
import com.msmall.community.common.Configuration;


public class HomeAction extends BaseAction{

	private static final long serialVersionUID = -1039908568906358282L;

	protected final Log log = LogFactory.getLog(HomeAction.class);
	public String execute(){
		String url = Configuration.getValue(Configuration.HOME_URL);
		if(!StringUtil.nullOrBlank(url) && !"/".equals(url)){
			try {
				if(!url.startsWith("/")){
					url = "/" + url;
				}
				getResponse().sendRedirect(getResponse().encodeRedirectURL( getRequest().getContextPath() + url));
				return null;
			} catch (Exception e) {
				log.error(e);
			}
		}
		return SUCCESS;
	}
}
